package main

import (
	"fmt"
	"io/ioutil"
	"os"
)

func p(i interface{}) {
	fmt.Println(i)
}
func main() {
	ra, _ := ioutil.ReadDir("D:/data")
	p(ra)
	for _, fi := range ra {
		p("---------")
		p(fi.Name())
		p(fi.IsDir())
		p(fi.Size())
		p(fi.ModTime())
		p(fi.Mode())
	}
	/*
			[0xc042034060 0xc0420340c0]
		---------
		access.log-20160304
		false
		3829
		2016-03-03 16:26:57 +0800 CST
		-rw-rw-rw-
		---------
		error.log
		false
		26948
		2016-03-04 15:15:07 +0800 CST
		-rw-rw-rw-
	*/
	fn := "D:/data/test.log"
	s := []byte("hello world")
	p(s)
	ioutil.WriteFile(fn, s, os.ModeAppend)
	rf, _ := ioutil.ReadFile(fn)
	p(rf)
	fmt.Printf("%s", rf)
}
